﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="clientCustomLensManager.aspx.cs"
    Inherits="clientCustomLensManager" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>客户与车房镜片</title>
    <link href="css/shipping.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/cs.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="../js/cs.js"></script>

    <script type="text/javascript" src="../js/jquery/jquery.js"></script>

    <script type="text/javascript" src="../js/jquery/jquery.plugin.js"></script>

    <script type="text/javascript" src="../js/jquery/jquery.autocomplete.js"></script>

    <link rel="stylesheet" type="text/css" href="../js/jquery/jquery.autocomplete.css" />

    <script type="text/javascript" src="js/autocomplete_Client_int.js"></script>

    <link href="css/datePicker.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="../js/datePicker.js"></script>

    <script type="text/javascript">
    
    //禁止回车提交表单
    function NoSubmit(e) {  
        var key = window.event ? e.keyCode : e.which; 
        if( key == 13 ) {
            return false;            
        }
        return true;
    }    
        
    //处理选择客户事件
    function selectClient(clientID, clientName) {
        var oldVal = $('#TextBoxClientID').val();
        if (oldVal == clientID) {
            return;
        }else {
            $('#TextBoxClientID').val(clientID);
            //触发onchange事件
            //$("#TextBoxClientID").fireEvent("change");         
        }
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <table id="searchTab" width="98%">
            <tr>
                <td width="50%" align="left" valign="top">
                    <asp:Panel ID="PanelSearch" runat="server">
                        客户：
                    <!-- 客户选择控件 Begin !-->
                    <asp:TextBox runat="server" ID="TextBoxClient" Width="220" autocomplete="off" Style="color: #999;"
                        Text="输入名称中任意字,  '*'查询全部" onfocus="this.style.color='#000'; if(this.value.indexOf('输入') > -1){this.value='';}"
                        onblur="if(this.value==''){this.value='输入名称中任意字,  \'*\'查询全部';this.style.color='#999';} else {this.style.color='#000';}" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                        ControlToValidate="TextBoxClientID" />
                    <asp:TextBox ID="TextBoxClientID" runat="server" AutoPostBack="True" CssClass="hidden"></asp:TextBox>
                    <!-- 客户选择控件 End !-->

                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="确定" CausesValidation="False"
                            CssClass="button" />
                    </asp:Panel>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="1"
                        CellSpacing="1" BorderWidth="0px" BackColor="#C6D5DC" CssClass="biaoresult" AllowPaging="True"
                        OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="20" OnRowCommand="GridView1_RowCommand"
                        Font-Size="Small" Width="98%">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <EditRowStyle BackColor="#999999" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <%--<asp:BoundField DataField="id" HeaderText="ID" />--%>
                            <asp:BoundField DataField="client_name" HeaderText="客户" />
                            <asp:BoundField DataField="client_type_name" HeaderText="性质" />
                            <asp:BoundField DataField="lens_name" HeaderText="镜片" />
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButtonEdit" runat="server" CausesValidation="False" Text="修改折扣率"
                                        CommandArgument='<%# Eval("id") %>' CommandName="command_edit"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButtonDel" runat="server" CausesValidation="False" Text="删除"
                                        CommandArgument='<%# Eval("id") %>' CommandName="command_del" OnClientClick="javascript:return confirm('你确认要删除吗？')"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:Panel ID="PanelAction" runat="server" Font-Size="small" Visible="false">
                        <asp:LinkButton ID="LinkButtonAdd" runat="server" CausesValidation="False" Text="添加"
                            OnClick="LinkButtonAdd_Click"></asp:LinkButton>
                        镜片
                    </asp:Panel>
                </td>
                <td align="left" valign="top">
                    <asp:Panel ID="PanelInput" runat="server">
                        <asp:TextBox ID="TextBoxLensID" runat="server" Visible="false" />
                        <asp:Label ID="LabelLensName" runat="server" Text=""  ForeColor="blue" /><br/>
                    <asp:Label ID="LabelErrorMsg2" runat="server" Text="" ForeColor="red"></asp:Label>
                    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="1"
                        CellSpacing="1" BorderWidth="0px" BackColor="#C6D5DC" CssClass="biaoresult" AllowPaging="True"
                        OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="50" Font-Size="Small" Width="98%">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <EditRowStyle BackColor="#999999" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="8"/>
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:BoundField DataField="sphere_begin" HeaderText="球径开始" ItemStyle-HorizontalAlign="right" />
                            <asp:BoundField DataField="sphere_end" HeaderText="球径结束" ItemStyle-HorizontalAlign="right" />
                            <asp:BoundField DataField="cylinder_begin" HeaderText="柱径开始" ItemStyle-HorizontalAlign="right" />
                            <asp:BoundField DataField="cylinder_end" HeaderText="柱径结束" ItemStyle-HorizontalAlign="right" />
                            <asp:BoundField DataField="sale_price" HeaderText="零售价" ItemStyle-HorizontalAlign="right" />
                            <asp:BoundField DataField="agent_price" HeaderText="代理价" ItemStyle-HorizontalAlign="right" />                            
                            <asp:TemplateField HeaderText="折扣率">
                                <ItemTemplate>
                                    <input type="hidden" value="<%#Eval("id") %>" name="lensPriceBaseID" />
                                    <input type="text" value="<%#Eval("price_coef") %>" name="priceCoef" size="1" maxlength="5" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="加价">
                                <ItemTemplate>
                                    <input type="text" value="<%#Eval("add_fee") %>" name="addFee" size="1" maxlength="5" />
                                </ItemTemplate>
                            </asp:TemplateField>                             
                        </Columns>
                    </asp:GridView>
                    <div align="right">
                    <asp:Button ID="ButtonSubmit" runat="server" OnClick="ButtonSubmit_Click" Text="保存" CssClass="button" />&nbsp;&nbsp;
                    </div>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Panel ID="PanelRef" runat="server" Font-Size="small" Visible="false">
                    镜片：<asp:DropDownList ID="DropDownListLens" runat="server" DataTextField="lens_name"
                            DataValueField="lens_id" />                            
                        <asp:Button ID="ButtonRef" runat="server" OnClick="ButtonRef_Click"  OnClientClick="doSubmit(this)" Text="添加" CssClass="button" CausesValidation="False" />
                        
                    </asp:Panel>
                </td>
            </tr>
        </table>
        <div>
                        <asp:Label ID="LabelErrorMsg" runat="server" Text="" ForeColor="red"></asp:Label></div>
    </form>
</body>
</html>
